package c.x.jy.dao.dao;

import c.x.jy.dao.dto.QuicktestEntityDto;
import c.x.jy.dao.entity.QuicktestEntity;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 闪测问题表
 * 
 * @author amwhyh
 * @email xxx@xx.com
 * @date 2021-05-25 11:29:31
 */
@Mapper
public interface QuicktestDao extends BaseMapper<QuicktestEntity> {
      @Select(" select * from t_quicktest where id=${id} for update ")
	QuicktestEntity selectQuickTestByidForUPdate(Long id);

    @Select(" select * from t_quicktest where hot=1  ORDER BY create_date desc limit 6 ")
    List<QuicktestEntity> hotlist();

    @Select("select q.*,qt.title typeTitle from t_quicktest q LEFT JOIN t_quicktest_type qt on qt.id=q.type_id  ${ew.customSqlSegment}")
    IPage<QuicktestEntityDto> querypage(IPage<QuicktestEntity> page,@Param(Constants.WRAPPER)  QueryWrapper<QuicktestEntity> query);
}

